<cfparam name="attributes.product_code" default="">
<cfparam name="attributes.version" default="">
<cfparam name="attributes.add_chg" default="chg">

<!--- 	
	<component>
	<product_code>05K5840</product_code>
	<quantity>1</quantity>
	<description></description>
	</component> 
--->
<cfoutput>
<cfsavecontent variable="var.kit_components">
<cfloop from="1" to="100" index="i">
	<cfif isdefined("form.product_code_#i#") and len(trim(evaluate("form.product_code_" & i)))>
	<component>
	   <product_code>#evaluate("form.product_code_" & i)#</product_code>
	   <quantity><cfif trim(evaluate("form.quantity_" & i)) neq "">#trim(evaluate("form.quantity_" & i))#<cfelse>1</cfif></quantity>
	   <description>#trim(evaluate("form.description_" & i))#</description>
	</component> 
	</cfif>
</cfloop>
</cfsavecontent>
</cfoutput>

<cfscript>
	xml = 
	'
	<!DOCTYPE copy SYSTEM "#attributes.dtd#">
	<xtiinput>
	   <inputheader>
	      <actionset>
	         <action>#attributes.add_chg#_kit</action>
	      </actionset>
	   </inputheader>
	   <inputdata>
	      <line_item>
	         <base>
	            <product_code>#trim(attributes.product_code)#</product_code>
	         </base>
			 #var.kit_components#
	       </line_item>
	   </inputdata>
	 </xtiinput>';
</cfscript>
	
<!--- <cfdump var="#xml#">
<cfabort> --->


